IF EXISTS ( SELECT 'X' FROM sys.views WHERE name = 'vMasterEventLog' AND schema_id = 1 )
BEGIN
     DROP VIEW dbo.vMasterEventLog
END
GO

CREATE VIEW dbo.vMasterEventLog
AS
/*
 *
 * vMasterEventLog
 *
 * Purpose:      
 *
 * Inputs:       
 *
 * Assumes:      
 *
 * Effects:      
 *
 * Returns:      
 *
 * Calling
 * Application:  
 *
 * Note(s):      
 *
 * Author(s):    NOVA Concepts Ltd.
 *
 * Change Log:   Initial Release, 12/05/2011, 1.00.0000
 *
 */
SELECT i.SrvrInstncFullName,
       i.SrvrInstncId, 
       SrvrDatabaseName = d.DatabaseName,
       l.EventLogId, 
       l.EventLogTypeId, 
       l.LogDt, 
       l.HostName, 
       l.LoginName, 
       l.DatabaseUserName, 
       l.DatabaseName, 
       l.AppName, 
       l.SPID, 
       l.SID, 
       l.LogByApp, 
       l.LogByAppSubSystem, 
       l.LogByDesc, 
       l.LogText, 
       l.TraceText, 
       l.TraceImage, 
       l.MiscVC1, 
       l.MiscVC2, 
       l.MiscVC3, 
       l.MiscVC4, 
       l.MiscInt1, 
       l.MiscInt2, 
       l.MiscInt3, 
       l.MiscInt4, 
       l.MiscTinyint1, 
       l.MiscTinyint2, 
       l.MiscTinyint3, 
       l.MiscTinyint4, 
       l.MiscDt1, 
       l.MiscDt2, 
       l.MiscDt3, 
       l.MiscDt4, 
       l.MiscGUID1, 
       l.MiscGUID2, 
       l.MiscGUID3, 
       l.MiscGUID4
FROM   dbo.MasterEventLog l INNER JOIN dbo.SrvrInstncDatabase d
          ON l.SrvrInstncDatabaseId = d.SrvrInstncDatabaseId
       INNER JOIN dbo.SrvrInstnc i
          ON d.SrvrInstncId = i.SrvrInstncId 
GO
